﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;

namespace ServicioLugares.Objetos
{
    [DataContract]
    public class RutaLugar
    {
        [DataMember(Name = "status")]
        public string Status { get; set; }
        [DataMember(Name = "routes")]
        public CRoutes[] Routes { get; set; }

        [DataContract]
        public class CRoutes
        {
            [DataMember(Name = "legs")]
            public Leg[] Legs { get; set; }

            [DataContract]
            public class Leg
            {
                [DataMember(Name = "distance")]
                public CData Distance { get; set; }

                [DataMember(Name = "duration")]
                public CData Duration { get; set; }

                [DataMember(Name = "end_location")]
                public CLocation End_Location { get; set; }

                [DataMember(Name = "start_location")]
                public CLocation Start_Location { get; set; }

                [DataMember(Name = "steps")]
                public Step[] Steps { get; set; }

                [DataContract]
                public class Step
                {
                    [DataMember(Name = "distance")]
                    public CData Distance { get; set; }

                    [DataMember(Name = "duration")]
                    public CData Duration { get; set; }

                    [DataMember(Name = "end_location")]
                    public CLocation End_Location { get; set; }

                    [DataMember(Name = "start_location")]
                    public CLocation Start_Location { get; set; }

                    [DataMember(Name = "polyline")]
                    public Polyline Polyline { get; set; }
                }
            }
        }
    }
    
    [DataContract]
    public class CLocation
    {
        [DataMember(Name = "lat")]
        public double Lat { get; set; }
        [DataMember(Name = "lng")]
        public double Lng { get; set; }
    }

    [DataContract]
    public class CData
    {
        [DataMember(Name = "text")]
        public string Text { get; set; }
        [DataMember(Name = "value")]
        public double Value { get; set; }
    }

    [DataContract]
    public class Polyline
    {
        [DataMember(Name = "points")]
        public string Points { get; set; }
        [DataMember(Name = "levels")]
        public string Levels { get; set; }
    }
}